<?php

namespace app\api\controller\yalimedia;

use app\admin\model\yalimedia\Uservip;
use app\admin\model\yalimedia\Vipcard;
use app\common\controller\Api;
use think\Exception;

/**
 * 其他接口
 */
class Block extends Api
{
    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['notifyx'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];

    /**
     * 支付成功回调
     */
    public function notifyx()
    {
        $paytype = "wechat";
        $pay = \addons\epay\library\Service::checkNotify($paytype);
        if (!$pay) {
            echo '签名错误';
            return;
        }
        $data = $pay->verify();
        try {

            $out_trade_no = $data['out_trade_no'];
            $order = new \addons\yalimedia\service\Order();
            $order->pay_success($out_trade_no);
        } catch (Exception $e) {

        }
        echo $pay->success();
    }

}
